/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Managers;

import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.scene.Node;
import com.jme3.ui.Picture;
import mygame.model.Game;

/**
 *
 * @author tsuyoshi
 */
public class MesajeManager {
    
    private Game game;
    private Node guiNode;
    private AssetManager assetManager;
    private BitmapFont guiFont;
    
    public MesajeManager(Game game, BitmapFont guiFont) {
        this.game=game;
        this.guiNode=game.getGuiNode();
        this.assetManager=game.getAssetManager();
        this.guiFont=guiFont;
        guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
    }
    
    public void clean(){
        guiNode.detachAllChildren();
    }
    
    public void showMesaje(String mesaje){
        clean();
        BitmapText messaje = new BitmapText(guiFont, false);
        messaje.setSize(guiFont.getCharSet().getRenderedSize());
        messaje.setText(mesaje);
        messaje.setLocalTranslation(300, messaje.getLineHeight(), 0);
        guiNode.attachChild(messaje);
    }
    
    public void showGoalImage(String imagePath){
        Picture pic = new Picture("HUD Picture");
        pic.setImage(assetManager, imagePath, true);
       
        int width=game.getContext().getSettings().getWidth();
        int height=game.getContext().getSettings().getHeight();
        
                
        pic.setWidth(width/2);
        pic.setHeight(height/2);
        pic.setPosition(width/4, height/4);
        
        guiNode.attachChild(pic);
    }
    
}
